package com.example.servlet.demo;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @program: sms
 * @description:
 * @author: zhanghz001
 * @create: 2020-11-04 09:46
 **/
@WebServlet("/DemoServlet02")
public class DemoServlet02 extends HttpServlet {
    private static final long serialVersionUID = 8123126550520460151L;

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req, resp);
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("收到请求DemoServlet02");
        //src/main/webapp/WEB-INF/pages/success.jsp
        req.getRequestDispatcher("/WEB-INF/pages/success.jsp").forward(req, resp);
        // resp.sendRedirect("/success.jsp");
    }
}
